{include file="public/header"}
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>角色管理>编辑</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/tt.css" />
    <style>
        html,
        body {
            margin:0;
            padding:0;
            width: 100%;
            background: rgba(238, 238, 238, 1);
        }
        .tt_top11{
            background:#3F3F3F;
        }
        .tt_top22{
            background:#fff;
        }
        .tt_top33{
            background:#2A63E7;
        }
        .container{
            padding-top:30px;
            padding-bottom:80px;
        }
        .box{
            width:1200px;
            height:auto;
            background:#fff;
            margin:auto;
            padding-top:68px;
            padding-bottom:326px;
            border-radius:3px;
        }
        .data{

            padding-left:128px;
            padding-right:144px;
        }
        .dataTitle{
            height:24px;
            margin-bottom:31px;
        }
        .dataContent{
            display: flex;
            margin-bottom:56px;
        }
        .dataContent1{
            display: flex;
            align-items: center;
            margin-bottom:35px;
        }
        .dataLeft{
            width:86px;
            font-size:14px;
            color:#333;
            font-weight:500;
            line-height: 20px;

        }
        .dataLeft1{
            width:86px;
            font-size:14px;
            color:#333;
            font-weight:500;
            line-height: 20px;

        }
        .inputt{
            width:520px;
            height:34px;
            border:1px solid #ccc;
            border-radius:3px;
            box-sizing: border-box;
            padding-left:10px;
            outline:none;
        }
        .inputt::-webkit-input-placeholder{
            color:#999;
            font-size:12px;
        }
        .inner{
            display: flex;
            /*align-items: center;*/
            margin-bottom:28px;

        }
        input[type="radio"]{
            -webkit-appearance:none;
            width:14px;
            height:14px;
            background:url(__IMG__/unselect_btn.png) no-repeat center center;
            background-size:100% 100%;
            outline: none;
            margin:5px 0 0;
            flex-shrink: 0;/*防止被压缩*/
        }
        input[type="radio"]:checked{
            -webkit-appearance:none;
            width:14px;
            height:14px;
            background:url(__IMG__/select_btn.png) no-repeat center center;
            background-size:100% 100%;
        }
        .rightText{
            font-size:14px;
            color:#666;
            line-height: 20px;
            padding-left:6px;
            word-wrap: break-word;
            word-break: break-all;
        }

        .btn{
            margin-left:86px;
            width:130px;
            height:34px;
            line-height:34px;
            background:#0065F0;
            border-radius:3px;

            text-align:center;
            font-size:12px;
            color:#fff;
        }
        .jianju{
            margin-bottom:60px;
        }

        .hidden{
            display: none
        }
    </style>
</head>

<body>
<header class="tt_topAll">
    <div class="tt_top3">
        <div class="tt_top33">角色管理>编辑</div>
    </div>
</header>
<div class="container">
    <div class="box">
        <div class="data">
            <form id="fabutask">
                <input type="hidden" name="id" value="{$data['role_id']}">
                <div class="dataContent1">
                    <div class="dataLeft1">角色名称</div>
                    <input type="text" class="inputt" name="keyword" placeholder="请输入角色名称" value="{$data['role_name']}">
                </div>
                <div class="dataContent flex-wrap">
                    <div class="dataLeft">设置权限</div>
                    <div class="rightBox flex-con">
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="1" {if in_array(1,$data['role_rule'])}checked{/if}>
                            <div class="rightText">任务管理（可发布、编辑、上架/下架、删除任务和查看任务详情，任务详情包括任务基本信息和用户领取信息）</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="2" {if in_array(2,$data['role_rule'])}checked{/if}>
                            <div class="rightText">任务审核（可查看审核普通任务、活动任务和达人任务的任务详情、可删除、审核任务）</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="3" {if in_array(3,$data['role_rule'])}checked{/if}>
                            <div class="rightText">达人中心（可查看达人中心中所有达人及达人详情</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="4" {if in_array(4,$data['role_rule'])}checked{/if}>
                            <div class="rightText">商家中心（1、可查看账户余额、企业认证状态、活动任务发布状态、代理商状态；2、可编辑商户基本信息；3、如果该商户号未企业认证、没有发布活动任务权限、没有申请代理商权限，那么可进行申请操作；4、不能进行充值和查看明细）</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="7" {if in_array(7,$data['role_rule'])}checked{/if}>
                            <div class="rightText">卡券管理（1、发布卡券；2、编辑卡券；3、下架卡券；4、删除卡券）</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="8" {if in_array(8,$data['role_rule'])}checked{/if}>
                            <div class="rightText">卡券核销（1、可核销卡券）</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="5" {if in_array(5,$data['role_rule'])}checked{/if}>
                            <div class="rightText">角色管理（可新增，编辑，删除角色)</div>
                        </div>
                        <div class="inner">
                            <input type="checkbox" name='role[]' value="6"{if in_array(6,$data['role_rule'])}checked{/if}>
                            <div class="rightText">账号管理(可新增，编辑，启用/禁用，删除账号）</div>
                        </div>
                    </div>
                </div>
                <div class="btn">保存</div>
            </form>
        </div>
    </div>
</div>


</body>
{include file="public/footer"}
<script type="text/javascript">
    $('.btn').click(function () {
        var name =   $.trim($(".inputt").val());
        if(name.length<1){
            alert("角色名称不能为空");
            return false;
        }
        if($("input[type='checkbox']").is(':checked') == false){
            alert("选择权限不能为空");
            return false;
        }
        var formData = $( "#fabutask" ).serialize();
        $.ajax({
            url: '/shop/role/updateTask',
            data: formData,
            type: 'POST',
            dataType: 'JSON',
            success: function (eturnData) {
                if(eturnData.status == 200){
                    window.location.href = '/shop/role/rolePage';
                }else{
                    location.reload();
                }
            }
        })
    });
</script>

</html>
